package com.hand.springcloud.controller;


import com.hand.springcloud.entities.Product;
import com.hand.springcloud.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ Description   :  部门微服务提供者REST：ProductController
 * @ Author        :  xiong.yilin@hand-china.com
 * @ CreateDate    :  2019/9/6 14:29
 */
@RestController
public class ProductController {

    @Autowired
    private ProductService productService;

    @RequestMapping(value = "/product/add",method = RequestMethod.POST)
    public boolean add(@RequestBody Product product){
        return productService.add(product);
    }

    @RequestMapping(value = "/product/get/{id}",method= RequestMethod.GET)
    public Product get(@PathVariable("id") Long id){
        return productService.get(id);
    }

    @RequestMapping(value = "/product/list", method=RequestMethod.GET)
    public List<Product> list(){
        return productService.list();
    }

}
